# Dataset of Bite Acquisition Strategies

## Folder Structure And Namimg

Each folder is named `<action>_<environment>`

| Action/Environment | Description |
| ----------- | ----------- |
| vertical_skewer | The handle of the fork is orthogonal to the table. |
| tilted\_vertical\_skewer | The tines of the fork are orthogonal to the table. |
| tilted\_angled | The handle of the fork is at a 45 degree angle to the table. Approach happens along this angle. |
| isolated | There are nothing around the food item. |
| wall | The food item is near the edge of the plate. |
| stacked | The food item is placed atop a bed of lettuce. |

The folder for each trial is labeled `<food name>-angle-<0/90>-trial-<#>`. It can be accessed by extracting the corresponding ZIP file.

An angle of *0* implies that the tines of the fork line up along the major axis of the bounding ellipse of the food item. An angle of *90* implies that the tines of the fork are perpendicular to that major axis.

Within each trial are the following folders:

| Folder | Description |
| ----------- | ----------- |
| `CamerainfoMsgs/<color/depth>` | Contains a single YAML file with the properties of the camera used to take the corresponding images. |
| `color` | Contains a sequence of the pick-up action in 3-5 RGB images, as described below. |
| `depth` | Contains a sequence of the pick-up action in 3-5 depth images, as described below. |
| `success`| Contains a single TXT file that says whether the action was successful or a failure. |

*Note: Each depth image is pixel-aligned with the correspondingly-named color image.*

## File Information
### Camera YAML (`cameraInfo.yaml`)

Contains the height, width and 2D distortion parameters (K; 3x3 matrix) of the corresponding color or depth images.

For example:
```
height: 480
width: 640
K:
  - 614.5933227539062
  - 0
  - 312.1358947753906
  - 0
  - 614.6914672851562
  - 223.7083129882812
  - 0
  - 0
  - 1
```

### Images (`image_#.png`)
Color Images: PNG image data, `<width>` x `<height>`, 8-bit/color RGB, non-interlaced
Depth Images: PNG image data, `<width>` x `<height>`, 16-bit grayscale, non-interlaced
*Depth image uses [OpenNI Raw Representation](https://www.ros.org/reps/rep-0118.html).*

### Success (`<food type>-#-#.txt`)
This TXT file contains a single string: `fail` if the fork made contact with the food item and did not pick it up, or `success` if the fork was able to pick up the food item.

## Consolidation Script

Once all ZIP files are extracted, the script `consolidate_successes.bash` can be used to consolidate all data into a single CSV file (`consolidated_successes.csv`) with the following row format:
```
<action>_<enviroment>+<food name>-angle-<0/90>-trial-<#>, <1/0>
```
where **1 is a failure and 0 is a success**.
